<script>

    /*
        入口页面不包含任何布局
        引用1个组件和两个页面:
        info.svelte

        main.svelte
        login.svelte
    */

    // 一些全局的方法

    import { onMount } from 'svelte';
    import { IsLogined } from './lib/token.js';
    import { ChanAccess } from './service.js';

    import Main from './pages/main.svelte'
    import Login from './pages/login.svelte'
    import Info from './components/info.svelte';

    let loginState = IsLogined();

    onMount(async () => {
        ChanAccess.subscribe(signal => {
            if(!signal && signal !== false) return
            loginState = signal;
        });
    });

</script>

<main>
    <Info /> <!--  -->
    {#if loginState}
        <Main />
    {:else}
        <Login />
    {/if}
</main>

<style>
    .container.svelte-9v4b0b{
        margin: 5px !important;
    }
</style>
